package com.example.spritedto;

import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.sprite.Sprite;
import org.anddev.andengine.opengl.texture.Texture;
import org.anddev.andengine.opengl.texture.TextureOptions;
import org.anddev.andengine.opengl.texture.region.TextureRegion;
import org.anddev.andengine.opengl.texture.region.TextureRegionFactory;

import android.content.Context;

public class BulletDTO implements InterfaceSprite{
	private Texture bulletTexture;
	private TextureRegion bulletRegion;
	private Sprite bulletSprite;
	private int posX;
	private int posY;
	
	public BulletDTO(int posX, int posY){
		this.posX = posX;
		this.posY = posY;
	}
	
	@Override
	public void onLoadResources(Engine mEngine, Context mContext) {
		TextureRegionFactory.setAssetBasePath("gfx/sprite/");
		bulletTexture = new Texture(32, 32, TextureOptions.BILINEAR);
		bulletRegion = TextureRegionFactory.createFromAsset(bulletTexture, mContext, "bullet.png", 0, 0);
		mEngine.getTextureManager().loadTexture(bulletTexture);
	}

	@Override
	public void onLoadScene(Scene mScene) {
		bulletSprite = new Sprite(posX, posY, bulletRegion);
		mScene.attachChild(bulletSprite);
	}

}
